package com.itheima.mapper;
import com.itheima.pojo.Repair;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

//分页查询：
@Mapper
public interface RepairMapper {
    //查询全部报修数据
   // @Select("select count(*) from repair")
  // public Long count();
    //分页查询获取列表数据
    //@Select("select * from repair limit #{start},#{pageSize}")
   // public List<Repair> page(Integer start,Integer pageSize);

    //宿舍报修信息查询
    @Select("select *from mybatis.repair")
    public List<Repair> list();


    //实现批量删除的操作
    void delete(List<Integer> ids);

////新增报修记录
    @Insert("insert into repair(roomNumber, repairReason, cost, createTime, updateTime) " +
            "values (#{roomNumber}, #{repairReason}, #{cost}, #{createTime}, #{updateTime})")
    void insert(Repair repair);

    //根据id来查询报修记录
    @Select("select  * from repair where id=#{id}")
    Repair getById(Integer id);

    //用来更新报修记录
    void update(Repair repair);
}
